package ru.sh.factory;

import ru.sh.jewel.BadJewel;
import ru.sh.jewel.GoodJewel;
import ru.sh.jewel.Jewel;
import ru.sh.jewel.NeedJewel;
import android.util.Log;
import framework.GameConfig;
import framework.managers.MathManager;
import framework.objects.DynamicGameObjectsGroup;
import framework.objects.ObjectFactory;
import framework.objects.hero.Hero;

public class JewelFactory extends ObjectFactory<Jewel> {

	private Hero hero;

	public JewelFactory(DynamicGameObjectsGroup<Jewel> group, int maxDely, Hero hero) {
		super(group, maxDely);
		this.hero = hero;
	}

	@Override
	protected void doCreation() {
		int type = MathManager.getRandom().nextInt(3);
		float xPosition = MathManager.getRandom().nextInt(GameConfig.BASE_WIDTH);
		switch (type) {
		case 0:
			group.add(new GoodJewel(xPosition, hero));
			break;
		case 1:
			group.add(new BadJewel(xPosition, hero));
			break;
		case 2:
			group.add(new NeedJewel(xPosition, hero));
			break;
		default:
			Log.e(null, "Error creating jewel");
			break;
		}		
	}

}
